
using Abp.Domain.Repositories;
using Microsoft.EntityFrameworkCore;
using System.Linq;


namespace SOEI.Solution.DomainEntities.ContractManagement.DomainService
{
    /// <summary>
    /// 领域服务层一个模块的核心业务逻辑
    ///</summary>
    public class ContractStatusManager : DomainServiceBase, IContractStatusManager
    {

        private readonly IRepository<ContractStatus, string> _contractstatusRepository;

        /// <summary>
        /// 【ContractStatus】的构造方法
        /// 通过构造函数注册服务到依赖注入容器中
        ///</summary>
        public ContractStatusManager(IRepository<ContractStatus, string> contractstatusRepository)
        {
            _contractstatusRepository = contractstatusRepository;
        }

        #region -------------------------------------------------辅助工具生成---------------------------------------------- 

        /// <summary>
        /// 返回列表查询用
        /// </summary>
        /// <returns></returns>
        public IQueryable<ContractStatus> QueryEntityListAsNoTracking()
        {

            var query = _contractstatusRepository.GetAll().AsNoTracking()
                        .Select(x => new ContractStatus
                        {
                            Id = x.Id,
                            StatusName = x.StatusName,
                        });
            return query;
        }

        /// <summary>
        /// 【ContractStatus】返回表达式数的实体信息即IQueryable类型
        /// </summary>
        /// <returns>IQueryable</returns>
        public IQueryable<ContractStatus> Query()
        {
            return _contractstatusRepository.GetAll();
        }

        /// <summary>
        /// 【ContractStatus】返回即IQueryable类型的实体，不包含EF Core跟踪标记
        /// </summary>
        /// <returns>IQueryable</returns>
        public IQueryable<ContractStatus> QueryAsNoTracking()
        {
            return _contractstatusRepository.GetAll().AsNoTracking();
        }

        #endregion


        #region -------------------------------------------------用户自定义------------------------------------------------
        /*请在此扩展领域服务接口*/
        #endregion









    }
}
